import { httpCreate } from './http'
import type { Data } from './types'

const http = httpCreate('/srv/auth')

export const auth = {
    pswLogin(data: { mobPhone: string; password: string }) {
        return http.Post<Data<LoginInfo>>('/loginByPwd', data, {})
    }
    // userInfo<T>() {
    //     return http.Get<T, CommonResponse<withData<UserInfo>>>('/login-info')
    // }
    // logout<T>() {
    //     return http.post<T, CommonResponse>('/logout')
    // }
}

export interface LoginInfo {
    areaCode: string
    createdOn: number
    avatarUrl: string
    displayName: string
    employeeNumber: null
    groups: null
    id: number
    idaasDeptId: string
    idaasUserId: string
    modifiedOn: number
    objectType: string
    phoneNum: string
    primaryMail: string
    secondaryMail: null
    status: string
    tenantId: string
    username: string
    userRole: null
    [prop: string]: any
}
